import Vuex from 'vuex'
const carStore = new Vuex.Store({
  state:{
    id: "",
    ids: [],
    routeStatusPush: false // 路由状态,该参数用来解决页面流转问题 是否是[car_compare] push到 [selectCar] 的
  },
  getters:{
    getId:function (state) {
      if(!state.id){
        state.id = null
      }
      return state.id;
    },
    getIds:function (state) {
      if(!state.ids){
        state.ids = []
      }
      return state.ids;
    },
    getRouteStatusPush:function (state) {
      if(!state.routeStatusPush){
        state.routeStatusPush = false
      }
      return state.routeStatusPush;
    }
  },
  mutations:{
    setId(state,id) {
      state.id = id;
    },
    setIds(state,ids) {
      state.ids = ids;
    },
    setRouteStatusPush(state,routeStatusPush) {
      state.routeStatusPush = routeStatusPush;
    }
  }
})

export default carStore